CumulativeAnimals<-function(df,unit){
df2<-data.frame(Unit=min(df[,unit],na.rm=T):max(df[,unit],na.rm=T),
Count=sapply(min(df[,unit],na.rm=T):max(df[,unit],na.rm=T),
function(l) length(unique(df[df[,unit]<=l,"Animal"]))
))
names(df2)[1]<-unit
return(df2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.